home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 50
/
Volume 50 - JOGO DISK .iso
/
Games
/
marionettemadness.swf
/
scripts
/
__Packages
/
com
/
mosesSupposes
/
fuse
/
FuseFMP.as
< prev
next >
Wrap
Text File
|
2007-10-01
|
18KB
|
534 lines
class com.mosesSupposes.fuse.FuseFMP
{
static var registryKey = "fuseFMP";
static var VERSION = com.mosesSupposes.fuse.FuseKitCommon.VERSION;
static var BLUR_ZERO = true;
function FuseFMP()
{
}
static function simpleSetup()
{
com.mosesSupposes.fuse.FuseFMP.initialize(MovieClip.prototype,Button.prototype,TextField.prototype);
_global.FuseFMP = com.mosesSupposes.fuse.FuseFMP;
for(var _loc2_ in com.mosesSupposes.fuse.FuseFMP._classes)
{
_global[_loc2_] = com.mosesSupposes.fuse.FuseFMP._classes[_loc2_];
}
}
static function initialize(target)
{
if(com.mosesSupposes.fuse.FuseFMP._classes == undefined)
{
com.mosesSupposes.fuse.FuseFMP._shortcuts = {getFilterName:function(f)
{
return com.mosesSupposes.fuse.FuseFMP.getFilterName(f);
},getFilterIndex:function(f)
{
return com.mosesSupposes.fuse.FuseFMP.getFilterIndex(this,f);
},getFilter:function(f, createNew)
{
return com.mosesSupposes.fuse.FuseFMP.getFilter(this,f,createNew);
},writeFilter:function(f, pObj)
{
return com.mosesSupposes.fuse.FuseFMP.writeFilter(this,f,pObj);
},removeFilter:function(f)
{
return com.mosesSupposes.fuse.FuseFMP.removeFilter(this,f);
},getFilterProp:function(prop, createNew)
{
return com.mosesSupposes.fuse.FuseFMP.getFilterProp(this,prop,createNew);
},setFilterProp:function(prop, v)
{
com.mosesSupposes.fuse.FuseFMP.setFilterProp(this,prop,v);
},setFilterProps:function(fOrPObj, pObj)
{
com.mosesSupposes.fuse.FuseFMP.setFilterProps(this,fOrPObj,pObj);
},traceAllFilters:function()
{
com.mosesSupposes.fuse.FuseFMP.traceAllFilters();
}};
com.mosesSupposes.fuse.FuseFMP._classes = {BevelFilter:flash.filters.BevelFilter,BlurFilter:flash.filters.BlurFilter,ColorMatrixFilter:flash.filters.ColorMatrixFilter,ConvolutionFilter:flash.filters.ConvolutionFilter,DisplacementMapFilter:flash.filters.DisplacementMapFilter,DropShadowFilter:flash.filters.DropShadowFilter,GlowFilter:flash.filters.GlowFilter,GradientBevelFilter:flash.filters.GradientBevelFilter,GradientGlowFilter:flash.filters.GradientGlowFilter};
com.mosesSupposes.fuse.FuseFMP._getter = {__resolve:function(name)
{
var _loc4_ = function()
{
var _loc3_ = this;
if(_loc3_.filters != undefined)
{
var _loc2_ = name.split("_");
if(_loc2_[1] == "blur")
{
_loc2_[1] = "blurX";
}
return com.mosesSupposes.fuse.FuseFMP.getFilter(this,_loc2_[0] + "Filter",false)[_loc2_[1]];
}
};
return _loc4_;
}};
com.mosesSupposes.fuse.FuseFMP._setter = {__resolve:function(name)
{
var _loc3_ = function(val)
{
var _loc2_ = this;
if(_loc2_.filters != undefined)
{
com.mosesSupposes.fuse.FuseFMP.setFilterProp(this,name,val);
}
};
return _loc3_;
}};
}
if(arguments[0] == null)
{
return undefined;
}
var _loc6_ = [MovieClip,Button,TextField];
for(var _loc13_ in arguments)
{
var _loc7_ = false;
for(var _loc10_ in _loc6_)
{
if(arguments[_loc13_] instanceof _loc6_[_loc10_] || arguments[_loc13_] == Function(_loc6_[_loc10_]).prototype)
{
_loc7_ = true;
break;
}
}
if(!_loc7_)
{
com.mosesSupposes.fuse.FuseKitCommon.error("201",_loc13_);
}
else
{
for(var _loc11_ in com.mosesSupposes.fuse.FuseFMP._classes)
{
var _loc5_ = new com.mosesSupposes.fuse.FuseFMP._classes[_loc11_]();
for(var _loc8_ in _loc5_)
{
if(typeof _loc5_[_loc8_] != "function")
{
var _loc4_ = _loc11_.substr(0,-6) + "_" + _loc8_;
arguments[_loc13_].addProperty(_loc4_,com.mosesSupposes.fuse.FuseFMP._getter[_loc4_],com.mosesSupposes.fuse.FuseFMP._setter[_loc4_]);
_global.ASSetPropFlags(arguments[_loc13_],_loc4_,3,1);
if(_loc8_ == "blurX")
{
_loc4_ = _loc4_.slice(0,-1);
arguments[_loc13_].addProperty(_loc4_,com.mosesSupposes.fuse.FuseFMP._getter[_loc4_],com.mosesSupposes.fuse.FuseFMP._setter[_loc4_]);
_global.ASSetPropFlags(arguments[_loc13_],_loc4_,3,1);
}
}
}
}
for(var _loc9_ in com.mosesSupposes.fuse.FuseFMP._shortcuts)
{
arguments[_loc13_][_loc9_] = com.mosesSupposes.fuse.FuseFMP._shortcuts[_loc9_];
_global.ASSetPropFlags(arguments[_loc13_],_loc9_,7,1);
}
}
}
}
static function deinitialize()
{
if(com.mosesSupposes.fuse.FuseFMP._classes == undefined)
{
return undefined;
}
if(arguments.length == 0)
{
arguments.push(MovieClip.prototype,Button.prototype,TextField.prototype);
}
for(var _loc8_ in arguments)
{
for(var _loc7_ in com.mosesSupposes.fuse.FuseFMP._classes)
{
var _loc4_ = new com.mosesSupposes.fuse.FuseFMP._classes[_loc7_]();
for(var _loc5_ in _loc4_)
{
if(typeof _loc4_[_loc5_] != "function")
{
var _loc3_ = _loc7_.substr(0,-6) + "_" + _loc5_;
_global.ASSetPropFlags(arguments[_loc8_],_loc3_,0,2);
arguments[_loc8_].addProperty(_loc3_,null,null);
delete arguments[_loc8_][_loc3_];
}
}
}
for(var _loc6_ in com.mosesSupposes.fuse.FuseFMP._shortcuts)
{
_global.ASSetPropFlags(arguments[_loc8_],_loc6_,0,2);
delete arguments[_loc8_][_loc6_];
}
}
}
static function getFilterName(instance)
{
if(com.mosesSupposes.fuse.FuseFMP._classes == undefined)
{
com.mosesSupposes.fuse.FuseFMP.initialize(null);
}
for(var _loc1_ in com.mosesSupposes.fuse.FuseFMP._classes)
{
if(instance.__proto__ == Function(com.mosesSupposes.fuse.FuseFMP._classes[_loc1_]).prototype)
{
return _loc1_;
}
}
return null;
}
static function getFilterIndex(target, filter)
{
if(com.mosesSupposes.fuse.FuseFMP._classes == undefined)
{
com.mosesSupposes.fuse.FuseFMP.initialize(null);
}
filter = com.mosesSupposes.fuse.FuseFMP.getInstance(filter);
if(filter === null)
{
return -1;
}
var _loc2_ = target.filters;
var _loc1_ = 0;
while(_loc1_ < _loc2_.length)
{
if(_loc2_[_loc1_].__proto__ == filter.__proto__)
{
return _loc1_;
}
_loc1_ = _loc1_ + 1;
}
return -1;
}
static function getFilter(target, filter, createNew)
{
var _loc1_ = com.mosesSupposes.fuse.FuseFMP.getFilterIndex(target,filter);
if(_loc1_ == -1)
{
if(createNew != true)
{
return null;
}
_loc1_ = com.mosesSupposes.fuse.FuseFMP.writeFilter(target,filter);
if(_loc1_ == -1)
{
return null;
}
}
return target.filters[_loc1_];
}
static function writeFilter(target, filter, propsObj)
{
if(com.mosesSupposes.fuse.FuseFMP._classes == undefined)
{
com.mosesSupposes.fuse.FuseFMP.initialize(null);
}
filter = com.mosesSupposes.fuse.FuseFMP.getInstance(filter);
if(filter === null)
{
return -1;
}
var _loc4_ = target.filters;
var _loc2_ = com.mosesSupposes.fuse.FuseFMP.getFilterIndex(target,filter);
if(_loc2_ == -1)
{
_loc4_.push(filter);
}
else
{
_loc4_[_loc2_] = filter;
}
target.filters = _loc4_;
if(typeof propsObj == "object")
{
com.mosesSupposes.fuse.FuseFMP.setFilterProps(target,filter,propsObj);
}
_loc2_ = com.mosesSupposes.fuse.FuseFMP.getFilterIndex(target,filter);
return _loc2_;
}
static function removeFilter(target, filter)
{
if(com.mosesSupposes.fuse.FuseFMP._classes == undefined)
{
com.mosesSupposes.fuse.FuseFMP.initialize(null);
}
filter = com.mosesSupposes.fuse.FuseFMP.getInstance(filter);
var _loc2_ = target.filters;
var _loc1_ = com.mosesSupposes.fuse.FuseFMP.getFilterIndex(target,filter);
if(_loc1_ == -1)
{
return false;
}
_loc2_.splice(_loc1_,1);
target.filters = _loc2_;
return true;
}
static function getFilterProp(target, propname, createNew)
{
var _loc1_ = propname.split("_");
if(_loc1_[1] == "blur")
{
_loc1_[1] = "blurX";
}
return com.mosesSupposes.fuse.FuseFMP.getFilter(target,_loc1_[0] + "Filter",createNew)[_loc1_[1]];
}
static function setFilterProp(target, propname, value)
{
if(com.mosesSupposes.fuse.FuseFMP._classes == undefined)
{
com.mosesSupposes.fuse.FuseFMP.initialize(null);
}
var _loc8_ = propname.split("_");
var _loc5_ = _loc8_[0] + "Filter";
if(com.mosesSupposes.fuse.FuseFMP._classes[_loc5_] == undefined)
{
return undefined;
}
var _loc2_ = new com.mosesSupposes.fuse.FuseFMP._classes[_loc5_]();
if(com.mosesSupposes.fuse.FuseFMP.BLUR_ZERO == true && _loc5_ == "BlurFilter")
{
_loc2_.blurX = _loc2_.blurY = 0;
}
var _loc6_ = _loc8_[1];
var _loc1_ = target.filters.length || 0;
while((_loc1_ = _loc1_ - 1) > -1)
{
if(target.filters[_loc1_].__proto__ == _loc2_.__proto__)
{
_loc2_ = target.filters[_loc1_];
break;
}
}
if(_loc2_ == null)
{
com.mosesSupposes.fuse.FuseKitCommon.error("202",_loc5_,target);
}
if(_loc6_ == "blur")
{
_loc2_.blurX = value;
_loc2_.blurY = value;
}
else
{
if(typeof value == "string" && _loc6_.toLowerCase().indexOf("color") > -1)
{
if(value.charAt(0) == "#")
{
value = value.slice(1);
}
value = value.charAt(1).toLowerCase() == "x" ? Number(value) : Number("0x" + value);
}
_loc2_[_loc6_] = value;
}
var _loc7_ = target.filters;
if(_loc1_ == -1)
{
_loc7_.push(_loc2_);
}
else
{
_loc7_[_loc1_] = _loc2_;
}
target.filters = _loc7_;
}
static function setFilterProps(target, filterOrPropsObj, propsObj)
{
if(arguments.length < 2)
{
com.mosesSupposes.fuse.FuseKitCommon.error("203",arguments.length);
return undefined;
}
if(com.mosesSupposes.fuse.FuseFMP._classes == undefined)
{
com.mosesSupposes.fuse.FuseFMP.initialize(null);
}
var _loc10_ = new Object();
var _loc11_ = arguments.length == 2;
if(_loc11_ == false)
{
var _loc14_ = com.mosesSupposes.fuse.FuseFMP.getFilterName(com.mosesSupposes.fuse.FuseFMP.getInstance(filterOrPropsObj));
if(com.mosesSupposes.fuse.FuseFMP._classes[_loc14_] == undefined)
{
com.mosesSupposes.fuse.FuseKitCommon.error("204",filterOrPropsObj);
return undefined;
}
_loc10_[_loc14_] = 1;
}
else
{
propsObj = filterOrPropsObj;
for(var _loc12_ in propsObj)
{
_loc14_ = _loc12_.split("_")[0] + "Filter";
if(com.mosesSupposes.fuse.FuseFMP._classes[_loc14_] != undefined && _loc10_[_loc14_] == undefined)
{
_loc10_[_loc14_] = 1;
}
}
}
if(!(target instanceof Array))
{
target = [target];
}
for(var _loc15_ in target)
{
var _loc5_ = target[_loc15_];
for(_loc14_ in _loc10_)
{
var _loc3_ = new com.mosesSupposes.fuse.FuseFMP._classes[_loc14_]();
if(com.mosesSupposes.fuse.FuseFMP.BLUR_ZERO == true && _loc14_ == "BlurFilter")
{
_loc3_.blurX = _loc3_.blurY = 0;
}
var _loc4_ = _loc5_.filters.length || 0;
while((_loc4_ = _loc4_ - 1) > -1)
{
if(_loc5_.filters[_loc4_].__proto__ == _loc3_.__proto__)
{
_loc3_ = _loc5_.filters[_loc4_];
break;
}
}
if(_loc3_ == null)
{
com.mosesSupposes.fuse.FuseKitCommon.error("202",_loc14_,_loc5_);
}
else
{
var _loc7_ = String(_loc14_).slice(0,-6) + "_";
for(_loc12_ in propsObj)
{
var _loc6_ = _loc12_.indexOf(_loc7_) == 0;
if(!(_loc11_ == true && _loc6_ == false))
{
var _loc2_ = propsObj[_loc12_];
if(_loc6_ == true)
{
_loc12_ = _loc12_.slice(_loc7_.length);
}
if(_loc12_ == "blur")
{
_loc3_.blurX = _loc2_;
_loc3_.blurY = _loc2_;
}
else
{
if(typeof _loc2_ == "string" && _loc12_.toLowerCase().indexOf("color") > -1)
{
if(_loc2_.charAt(0) == "#")
{
_loc2_ = _loc2_.slice(1);
}
_loc2_ = _loc2_.charAt(1).toLowerCase() == "x" ? Number(_loc2_) : Number("0x" + _loc2_);
}
_loc3_[_loc12_] = _loc2_;
}
}
}
var _loc8_ = _loc5_.filters;
if(_loc4_ == -1)
{
_loc8_.push(_loc3_);
}
else
{
_loc8_[_loc4_] = _loc3_;
}
_loc5_.filters = _loc8_;
}
}
}
}
static function getAllShortcuts()
{
if(com.mosesSupposes.fuse.FuseFMP._classes == undefined)
{
com.mosesSupposes.fuse.FuseFMP.initialize(null);
}
var _loc2_ = [];
for(var _loc4_ in com.mosesSupposes.fuse.FuseFMP._classes)
{
var _loc1_ = new com.mosesSupposes.fuse.FuseFMP._classes[_loc4_]();
for(var _loc3_ in _loc1_)
{
if(typeof _loc1_[_loc3_] != "function")
{
_loc2_.push(_loc4_.substr(0,-6) + "_" + _loc3_);
if(_loc3_ == "blurX")
{
_loc2_.push(_loc4_.substr(0,-6) + "_blur");
}
}
}
}
return _loc2_;
}
static function traceAllFilters()
{
if(com.mosesSupposes.fuse.FuseFMP._classes == undefined)
{
com.mosesSupposes.fuse.FuseFMP.initialize(null);
}
var _loc1_ = "------ FuseFMP filter properties ------\n";
for(var _loc4_ in com.mosesSupposes.fuse.FuseFMP._classes)
{
_loc1_ += _loc4_;
var _loc2_ = new com.mosesSupposes.fuse.FuseFMP._classes[_loc4_]();
for(var _loc3_ in _loc2_)
{
if(typeof _loc2_[_loc3_] != "function")
{
_loc1_ += "\t- " + _loc4_.substr(0,-6) + "_" + _loc3_;
if(_loc3_ == "blurX")
{
_loc1_ += "\t- " + _loc4_.substr(0,-6) + "_blur";
}
}
}
_loc1_ += "\n";
}
com.mosesSupposes.fuse.FuseKitCommon.output(_loc1_);
}
static function getInstance(filter)
{
if(filter instanceof flash.filters.BitmapFilter)
{
return flash.filters.BitmapFilter(filter);
}
if(typeof filter == "function")
{
for(var _loc4_ in com.mosesSupposes.fuse.FuseFMP._classes)
{
if(filter == com.mosesSupposes.fuse.FuseFMP._classes[_loc4_])
{
var _loc1_ = new com.mosesSupposes.fuse.FuseFMP._classes[_loc4_]();
if(com.mosesSupposes.fuse.FuseFMP.BLUR_ZERO == true && _loc4_ == "BlurFilter")
{
_loc1_.blurX = _loc1_.blurY = 0;
}
return _loc1_;
}
}
}
if(typeof filter == "string")
{
var _loc3_ = String(filter);
if(_loc3_.substr(-6) != "Filter")
{
_loc3_ += "Filter";
}
for(_loc4_ in com.mosesSupposes.fuse.FuseFMP._classes)
{
if(_loc4_ == _loc3_)
{
_loc1_ = new com.mosesSupposes.fuse.FuseFMP._classes[_loc4_]();
if(com.mosesSupposes.fuse.FuseFMP.BLUR_ZERO == true && _loc4_ == "BlurFilter")
{
_loc1_.blurX = _loc1_.blurY = 0;
}
return _loc1_;
}
}
}
return null;
}
}